package com.qf.service;

import com.github.pagehelper.PageHelper;
import com.qf.dao.ProfileDao;
import com.qf.pojo.PageBean;
import com.qf.pojo.Profile;

import java.util.List;

public class ProfileServiceImpl implements ProfileService{
    ProfileDao profileDao;

    public void setProfileDao(ProfileDao profileDao) {
        this.profileDao = profileDao;
    }

    @Override
    public PageBean<Profile> findByPage(int page_num,int page_size) {
        PageHelper.startPage(page_num,page_size);
        List<Profile> data = profileDao.selectByPage();
        long totalSize = profileDao.getCount();
        PageBean<Profile> pageBean = new PageBean<Profile>(page_num,page_size,totalSize,data);
        return pageBean;
    }
    @Override
    public Profile findDetailById(String id) {
        return profileDao.selectById(id);
    }

    @Override
    public void modify(Profile profile) {
        profileDao.update(profile);
    }
}
